<%--
  Created by IntelliJ IDEA.
  User: 左宏
  Date: 2020/10/4
  Time: 15:26
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<%@ taglib prefix="shiro" uri="http://shiro.apache.org/tags" %>
<%
    String path=request.getContextPath()+"/";
//    String basePath=request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+"/"+path;

%>
<html>
<head>
    <title>授课信息管理</title>
    <link href="<%=path%>static/css/bootstrap.min.css?v=3.3.6" rel="stylesheet">
    <link href="<%=path%>static/css/font-awesome.css?v=4.4.0" rel="stylesheet">
    <link href="<%=path%>static/css/animate.css" rel="stylesheet">
    <link href="<%=path%>static/css/style.css?v=4.1.0" rel="stylesheet">
</head>

<body class="gray-bg">
<div class="wrapper wrapper-content animated fadeIn">
    <div class="tabs-container">
        <ul class="nav nav-tabs">
            <c:if test="${fn:contains(sessionScope.roles,'教务主任' )}">
                <li id="p1" class=""><a data-toggle="tab" href="#tab-1" aria-expanded="true"> 任一班级</a>
                </li>
            </c:if>
            <c:if test="${fn:contains(sessionScope.roles,'班主任' )}">
            <li id="p2" class=""><a data-toggle="tab" href="#tab-2" aria-expanded="false">我的班级</a>
                </c:if>
                <c:if test="${fn:contains(sessionScope.roles,'任课教师' ) or fn:contains(sessionScope.roles,'学生')}">
            <li id="p3" class=""><a data-toggle="tab" href="#tab-3" aria-expanded="false">我的课程</a>
                </c:if>
            </li>
        </ul>
        <div class="tab-content">
            <div id="tab-1" class="tab-pane">
                <div class="panel-body">
                    <c:if test="${fn:contains(sessionScope.roles,'教务主任' )}">
                        <iframe width="100%" height="90%"  style="border: medium none" src="getTimetable?op=0"></iframe>
                    </c:if>
                </div>
            </div>
            <div id="tab-2" class="tab-pane">
                <div class="panel-body">
                    <c:if test="${fn:contains(sessionScope.roles,'班主任' )}">
                        <iframe width="100%" height="90%"  style="border: medium none" src="getTimetable?op=1"></iframe>
                    </c:if>
                </div>
            </div>
            <div id="tab-3" class="tab-pane">
                <div class="panel-body">
                    <c:if test="${fn:contains(sessionScope.roles,'任课教师' ) or fn:contains(sessionScope.roles,'学生')}">
                        <iframe width="100%" height="90%"  style="border: medium none" src="getTimetable?op=2"></iframe>
                    </c:if>
                </div>
            </div>
        </div>
    </div>
</div>
<!-- 全局js -->
<script src="<%=path%>static/js/jquery.min.js?v=2.1.4"></script>
<script src="<%=path%>static/js/bootstrap.min.js?v=3.3.6"></script>

<!-- 自定义js -->
<script src="<%=path%>static/js/content.js?v=1.0.0"></script>


</body>

</html>
<script>
    $(function () {
        let str="${sessionScope.roles}";
        let roles=str.substring(1,str.length-1).split(',');
        console.log(roles);
        var arr=[
            {name:'学生',value:3},
            {name:'任课教师',value:3},
            {name:'班主任',value:2},
            {name:'教务主任',value:1}
        ];
        for(let i in arr){
            let b=arr[i];
            let f=false;
            for(let j in roles) {
                let o=roles[j];
                if (b.name === o) {
                    $("#p" + b.value).attr("class", "active");
                    $("#tab-" + b.value).attr("class", "tab-pane active");
                    f = true;
                    break;
                }
            }
            if(f)break;
        }
    });
</script>
